package com.ruoyi.controller;

import com.ruoyi.domain.dto.BookDto;
import com.ruoyi.domain.dto.CategoryDto;
import com.ruoyi.service.ICategoryService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;

/**
 * 【请填写功能名称】Controller
 *
 * @author ruoyi
 * @date 2023-12-27
 */
@RestController
@RequestMapping("/categoryManage")
public class CategoryController extends BaseController
{
    @Autowired
    private ICategoryService categoryService;

    @RequestMapping("addCategory")
    @Log(title = "图书分类增加" ,businessType = BusinessType.INSERT)
    public AjaxResult addCategory(@RequestBody CategoryDto categoryDto){
        return categoryService.addCategory(categoryDto);
    }
    @RequestMapping("deleteCategory")
    @Log(title = "图书分类删除" ,businessType = BusinessType.DELETE)
    public AjaxResult deleteCategory(@RequestBody BookDto bookDto){
        return categoryService.deleteCategory(bookDto.getBookId());
    }
    @RequestMapping("selectCategory")
    public AjaxResult selectCategory(){
        return categoryService.selectCategory();
    }

}
